#include "privilege.h"

#include <gtest/gtest.h>

#include <QCoreApplication>
#include <Request/Login.h>
#include <Server.h>

bool obtainUserPrivilege()
{
	Server();
	TC::Request::Login l;
	l.login("testUser", "0403");
	while (l.status() == TC::Request::Login::Status::Communicating)
		QCoreApplication::processEvents();
	EXPECT_EQ(TC::Request::Login::Status::Ok, l.status());
	return l.status() == TC::Request::Login::Status::Ok;
}

bool obtainAdminPrivilege()
{
	Server();
	TC::Request::Login l;
	l.login("testAdmin", "0403");
	while (l.status() == TC::Request::Login::Status::Communicating)
		QCoreApplication::processEvents();
	EXPECT_EQ(TC::Request::Login::Status::Ok, l.status());
	return l.status() == TC::Request::Login::Status::Ok;
}
